Q02. I want to restrict the models that can be associated

By defining the reference relationship between entities in the metamodel, you specify the type of model (metamodel class) that can be related as a reference destination. In that case, when you try to add the referenced model, all the models in the project will be narrowed down and the candidates that can be related to the model type will be listed.

On the other hand, you can apply constraints to narrow down the candidates that can be associated from a specific range of models.

For example, consider the following metamodel structure:

Example of path constraints

  • Subsystems and components own functions. ・・・(2) and (4) in the figure
  • Modules use functions. ・・・(5) in the figure

Following this metamodel structure, the candidate functions available in the module are both subsystem functions and component functions. On the other hand, suppose your module has a design constraint that only subsystem functions ((2) in the figure) are available, and component functions ((4) in the figure) are not.

Next Design allows you to apply such a constraint to a reference relation ((5) in the figure).

To constrain a reference association, add a constraint to the reference association defined in the metamodel. In the constraint, based on the metamodel structure, specify the path (hereinafter referred to as path constraint) from the reference source entity to the associable reference destination entity. In the above example, specify the path (1)-(2) in the figure from the reference source module to the reference destination function as follows.

$Parent.PublicFunctions

After applying a path constraint, verify that the path constraint works correctly, and verify that there are no points in the project that violate the path constraint. This enables you to detect and deal with constraint violation points even if you add a path constraint to an existing project later or change the path constraint.

In the following, the path constraint for the reference relation between entities will be explained in the following order.

  • Add/change path constraint
  • Edit model according to path constraint
  • Validate path constraints

Add/change path constraint

To add a path constraint to the referential relationship between entities or change the added path constraint, perform the following steps.

Add/Change path constraints

Operating procedure

  1. Select the entity that holds the field for which you want to add a path constraint by doing one of the following:
    • In the profile navigator, view the class diagram that contains the entity and select the entity.
    • Select the relevant entity in the Profile Navigator tree.
  2. From the ribbon, click Display> Pane> Inspector to bring up the inspector on the right and scroll down to the Constraints list.
  3. To add a path constraint, click the + button at the bottom right of the Constraints list.
  4. In the [Add constraint] dialog, set the following items.
    • Enter a name for the constraint in Display Name and Name.
    • For Kind, select Path Constraint.
    • Select [Reference to Usage Function (Reference to Usage Function)] in [Target Field].
    • In [Path], enter the path that is allowed to be associated according to the notation of the path constraint.
  5. Click the [OK] button in the dialog to add the path constraint.
  6. To modify the path constraint you just added, hover over the constraint in the Constraints list in the Inspector and click the edit icon.
  7. Change the settings in the [Constraint setting] dialog and click the [OK] button.

Note

  • Existing models will be maintained even if path constraints are added or changed.
  • To check whether the existing model satisfies the path constraint, follow the "Verify path constraint" below and perform an error check.

Path constraint notation

The format and elements of the path constraint are as follows.

Format: {path element}.{path element}....;{path element}.{path element}....

{Path element} Description
$Parent Parent entity
Field Name Field name corresponding to the path to the related destination
Special symbols Description
. (Period) Symbol that connects the elements of the path
; (Semicolon) Delimiter to list multiple path constraints in or condition

Edit model according to path constraint

If a path constraint is added and you try to associate it with a model that does not satisfy the path constraint in the ER diagram, an error will be displayed and you will not be able to associate.

GIF animation

Then, if you try to add a referenced model using a form, only model candidates that satisfy the path constraint will be displayed in a list.

GIF animation

Verify path constraints

To check where a path constraint is violated in your project, do the following:

Screen capture_or_GIF animation

Operating procedure

  1. Click [Home]> [Model]> [Check Error] on the ribbon to display any path constraint violations in the error list.
  2. To jump to the error location, double-click the error displayed in the error list.
  3. Do one of the following to clear the error list.
    • From the ribbon, click [▼] at the bottom of [Home]> [Model]> [Check Error], and click [Clear Error].
    • Click the [Clear error] button on the toolbar of the error list.